package cn.ven.service;

import cn.ven.entity.*;
import cn.ven.mapper.OrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class OrderServiceImpl implements OrderService {

    @Autowired(required = false)
    OrderMapper orderMapper;

    //根据订单号查找对应订单明细与书本信息
    @Override
    public List<ItemBook> findItemInfoByOrdid(Integer ordid) {
        return orderMapper.findItemInfoByOrdid(ordid);
    }

    //根据订单号
    @Override
    public void addShip(Order order) {
        orderMapper.addShip(order);
    }

    //动态查询订单头信息
    @Override
    public List<OrdInfo> findOrdInfo(Map<String, Object> map) {
        return orderMapper.findOrdInfo(map);
    }

    //动态查询结果数据总条数
    @Override
    public Integer getCount(Map<String, Object> map) {
        return orderMapper.getCount(map);
    }

    //根据用户id和订单号查找订单明细
    @Override
    public List<OrdItem> findOrdItem(Integer uid, Integer ordid) {
        return orderMapper.findOrdItem(uid, ordid);
    }

    //更新电话和地址
    @Override
    public void updateOrder(Order order) {
        orderMapper.updateOrder(order);
    }

    //更换付款标识
    @Override
    public void addPay(Integer ordid) {
        orderMapper.addPay(ordid);
    }

    //动态查询订单头以及详细信息
    @Override
    public List<OrderLine> findOrdLines(Map<String, Object> map) {
        return orderMapper.findOrdLines(map);

    }

    //动态查询总条数
    @Override
    public Integer getOrderLinesCount(Map<String, Object> map) {
        return orderMapper.getOrderLinesCount(map);
    }


}
